/**
 * Created by Administrator on 2016/7/14 0014.
 */
directives.directive('lightPhoto', ["$rootScope", "tools", "$timeout", function ($rootScope, tools, $timeout) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        templateUrl: "/trend-new-BI/app/components/priceMonitor/lightPhoto/lightPhotoView.html",
        link: function (scope, element, attr) {

            $rootScope.$on("lightPhoto_EV",function(e,data){
                scope.title=data.title;


                   $timeout(function(){
                       if(data.index==0){
                           $(element).find(".ui.image").css({
                               "background":'url(http://'+data.src+')',
                               "backgroundSize":"100% 100%"
                           });
                       }else{
                           $(element).find(".ui.image").css({
                               "background":'url(/trend-new-BI/assets/img/price/'+data.src+')',
                               "backgroundSize":"100% 100%"
                           });
                       }

                       $(element).modal({
                           blurring: true
                       }).modal('show');
                   },300);

            });
        }
    }
}]);